﻿#pragma once
#include <memory>
#include <string>
#include <clamav/clamav.h>
#include "../common/utilities/singleton.h"
#include <fstream>
// Include the Process class from the previous example
class PathQueueSet;
class DirQueueSet;
class CYunDunDefenderDlg;
class ProcessFramework:public Singleton<ProcessFramework>
{
public:
    ProcessFramework();
private:
    
    std::shared_ptr<ProcessFramework> self_ptr;
    unsigned int m_signo = 0;
    cl_scan_options m_scanoptions;
public:
    void Init();
    int InitDataBase();
    void work();
    void stop_work();
    void pause_work();
    void resume_work();
    int ScanFile(std::wstring strpath);
    void AddDir(std::wstring strdir);
    void AddPath(std::wstring strpath);
    void WriteData(std::string virname, unsigned long int scanned,std::string filename);
    void SetYunDunDefenderDlg(std::shared_ptr<CYunDunDefenderDlg>& yddlg);
public:
    std::shared_ptr<PathQueueSet> m_pathqs;
    std::shared_ptr<DirQueueSet> m_dirqs;
    std::shared_ptr<CYunDunDefenderDlg> m_yddlg;
    cl_engine* m_engine = nullptr;
    std::mutex process_mutex;
    DWORD m_dwfilenumber = 0;
    DWORD m_allfienumber = 0;
    DWORD m_badFilenumber = 0;
    std::string m_ip;
    std::wofstream outfile;
    std::wstring m_savepath;
};
